<template>
  <div class="singer">
    <div class="singer-item" v-for="item of artists" :key="item.id">
      <img v-lazy="item.picUrl"/>
      <span class="singer-item-name">{{ item.name }}</span>
    </div>
  </div>
</template>

<script>
import Mixins from "./Mixins";

export default {
  name: 'Singer',
  mixins: [Mixins],
  data() {
    return {
      artists: [], // 歌手数据
    }
  },
  watch: {
    // 侦听路由
    '$route.query': {
      async handler() {
        // 获取歌手
        let {artists} = await this.getSongs({type: 100, pageSize: 20})
        this.artists = artists
      },
      immediate: true
    }
  },
  methods: {}
}
</script>

<style lang="less" scoped>
.singer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.singer-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-right: 20px;
  margin-bottom: 20px;

  img {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    margin-bottom:10px;
  }

  .singer-item-name {
    font-size: 16px;
  }

  .singer-item-works {
    color: #909399;
    font-size: 12px;
    margin-top: 4px;
  }
}
</style>
